package org.sakai.config;

import io.minio.MinioClient;
import jakarta.annotation.Resource;
import lombok.Getter;
import org.sakai.config.pojo.MinioAdminConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class MinioConfig {
    //导入minio配置
    @Autowired
    MinioAdminConfig adminConfigProperty;

    /**
     * 配置全局的minio连接
     * @return
     */
    @Bean
    MinioClient AdminMinioClient(){
         MinioClient adminMinioClient = MinioClient.builder()
                .endpoint(adminConfigProperty.getEndpoint())
                .credentials(adminConfigProperty.getSecretKey(), adminConfigProperty.getSecretPassword())
                .build();
         return adminMinioClient;
    }
}

